package org.frame.gateway.config;

import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import lombok.extern.slf4j.Slf4j;
import reactor.core.publisher.Mono;

@Slf4j
@Configuration
public class CustomResolver {
    @Bean
    public KeyResolver ipKeyResolver(){
        log.debug("ipKeyResolver init");
        return exchange -> Mono.just(exchange.getRequest().getRemoteAddress().getHostName());
    }
}
